var yuZoomKey = 'swuofDsd6dLK5Qf9a8D67';
	$(function(){
		$("#li_3d li").click(function(){
			var id = $(this).attr("index");
			if(cur_id == id){
				yuZoom.autoPlay(80,2);
				return;
			}
			var result = yuZoom.change({
				content: $("#show_3d"),
				toolsPosition : 'top',
				configUrl : 'http:/'+'/www.duoec.com/json.php?id='+id
				//configUrl : 'http:/'+'/www.duoec.com:8080/wap5/YuZoom.json/'+id
			});
			if(result){
				cur_id = id;
				yuZoom.autoPlay(80,2);
				$("#li_3d li.selected").removeClass("selected");
				$(this).addClass("selected");
			}
		});
		yuZoom = new YuZoom({
			content: $("#show_3d"),
			//configUrl : 'http:/'+'/www.duoec.com:8080/wap5/YuZoom.json/37'
			// configUrl : 'http://yulin.duoec.com/index.php?app=show360&act=config&id=853AA9D51096460A940F0AB1F19911E2'
			configUrl : 'http://ww.duoec.com/Show360/Conf/528a07227a042bc30e000000'
		});
		cur_id = 12;
		//yuZoom.autoPlay({callback:shake});
		//yuZoom.autoPlay({ count:2});
		
	});
	
	function shake(){
		var state = yuZoom.getState();
		$("#yuZoom_" + state.id).mouseover(function(){
			shake_stop = true;
			
		}).mouseout(function(){
			shake_stop = false;
			setTimeout(function(){
				//shake_help();
			},0);
		});
		var middle_count = parseInt(state.count / 2);
		yuZoom.turn(middle_count,function(){
			//shake_help();
		});
	}
	
	
	
	var shake_stop = false;
	var cur_shake_revert = true;
	var ii = 0;
	function shake_help(){
		if(shake_stop)return;
		var state = yuZoom.getState();
		var speed = 80;//Math.abs(parseInt(Math.sin(180 * state.clockwiseLevel * 2 / state.count) * 200));
		//document.title = ii + ":" + state.clockwiseLevel + "--" + speed;
		if(state.clockwiseLevel==1){
			cur_shake_revert = false;
		}
		if(state.clockwiseLevel == state.count / 2)
			cur_shake_revert = true;
		yuZoom.turn(cur_shake_revert?-1:1);
		setTimeout(function(){
			++ii;			
			shake_help();
		},speed);
	}

	function hide_box(){
		$("#trial_box_mb").remove();
		$("#trial_box").remove();
	};
var yuZoom = null;
	var cur_id = 0;